﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ListenMusic.Models.Reposistory.Public;
using ListenMusic.Comment_ServiceReference;
namespace ListenMusic.Controllers.Public
{
    public class CommentController : Controller
    {
        //
        // GET: /Comment/
        CommentReposistory _comment;
        public CommentController()
        {
            _comment = new CommentReposistory();
        }
        public JsonResult LoadSongComment(int pageindex,int songid)
        {
            int pagesize = 5;            
            int start = ((pageindex - 1) * pagesize + 1) - 1 ;
            int end = pageindex * pagesize;
            List<CommentMemberSong> lst_comment = _comment.getAllCommentBy_SongID(start,end,songid);
            return Json(lst_comment);
            
        }
        public JsonResult LoadAlbumComment(int pageindex,int albumid)
        {
            int pagesize = 5;           
            int start = ((pageindex - 1) * pagesize + 1) - 1;
            int end = pageindex * pagesize;
            List<CommentMemberAlbum> lst_comment = _comment.getAllCommentBy_AlbumID(start, end, albumid);
            return Json(lst_comment);
        }

    }
}
